package com.cfec.ipoth_service.Controller;


import com.cfec.ipoth_service.domain.User;
import com.cfec.ipoth_service.service.UserService;
import com.cfec.ipoth_service.util.ResultData;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

//@CrossOrigin(origins = "http://localhost:8081", methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.OPTIONS}, allowedHeaders = "*", allowCredentials = "true")
@RestController
@RequestMapping("/user")
@ApiOperation("控制层:用户")
@Slf4j
public class UserController {

    @Autowired
    UserService userService;

    @Resource(name = "user")
    User user;


    @GetMapping("select")
    @ApiOperation("查询")
    public List<User> select(){
        return userService.list();
    }

    @ApiOperation("登录接口")
    @PostMapping("/login")
    public ResultData login(@RequestBody User user){
        ResultData resultData = userService.select(user);
        return resultData;
    }

//    @ApiOperation("用户列表查询接口")
//    @GetMapping("/selectList")


}